﻿public class IndexedNames
{
    private string[] namelist;
    public int size;

    public IndexedNames(int size)
    {
        this.size = size;
        namelist = new string[size];

        for (int i = 0; i < size; i++)
        {
            namelist[i] = "N. A";
        }
    }

    public string this[int index]
    {
        get
        {
            string temp;

            if (index >= 0 && index < size)
            {
                temp = namelist[index];
            }
            else
            {
                temp = "";
            }

            return temp;
        }
        set
        {
            if (index >= 0 && index < size)
            {
                namelist[index] = value;
            }
        }
    }
}
class Program
{
    static void Main(string[] args)
    {
        IndexedNames index = new IndexedNames(5);
        index[0] = "Zara";
        index[1] = "Riz";
        index[2] = "Nuha";
        index[3] = "Asif";
        index[4] = "Davinder";

        for (int i = 0; i < index.size; i++)
        {
            System.Console.WriteLine(index[i]);
        }

        System.Console.ReadKey();
    }
}